package per.lance.easytomcat.adapter;

import per.lance.easytomcat.handler.StaticHandler;
import per.lance.easytomcat.net.HttpRequest;
import per.lance.easytomcat.net.HttpRespone;

import java.lang.reflect.InvocationTargetException;

/**
 * @author Lance Li
 * @date 7/9/2018 1:22 PM
 * @desc
 */
public class StaticHandlerAdapter implements HandlerAdapter {
    public boolean supports(Object handler) {
        return (handler instanceof StaticHandler);
    }

    @Override
    public void handle(Object handler, Object... args) throws IllegalAccessException, InvocationTargetException, ClassNotFoundException {
        ((StaticHandler) handler).doStaticHandler((HttpRequest) args[0], (HttpRespone) args[1]);
    }
}
